package top.taooc.example.consumer;

import top.taooc.example.common.model.User;
import top.taooc.example.common.service.UserService;
import top.taooc.proxy.ServiceProxyFactory;

/**
 * @author songtao@guishangyi.cn
 * @date 2024年06月25日 10:08:35
 * @packageName top.taooc.example.consumer
 * @className EasyConsumerExample
 * @Menu
 */
public class EasyConsumerExample {
    public static void main(String[] args) {
        //静态代理
//        UserService userService = new UserServiceProxy();
        UserService userService = ServiceProxyFactory.getProxy(UserService.class);
        User user = new User();
        user.setName("taooc");
        //调用
        User newUser = userService.getUser(user);
        if (newUser != null) {
            System.out.println(newUser.getName());
        } else {
            System.out.println("user==null");
        }
    }
}
